package com.qtenv.datasync.service.entity.msmapper;


import com.qtenv.datasync.service.entity.convert.FileFlowMeter;
import com.qtenv.datasync.service.entity.degao.DgTerminalArchive;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.factory.Mappers;

@org.mapstruct.Mapper(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface DgTerminalFileFlowMapper {
    DgTerminalFileFlowMapper INSTANCE = Mappers.getMapper(DgTerminalFileFlowMapper.class);

    @Mappings({
            @Mapping(source = "id", target = "ID"),
            @Mapping(source = "imei", target = "IMEI"),
            @Mapping(source = "name", target = "FFM_NAME"),
            @Mapping(source = "pipeDN", target = "DN"),
//            @Mapping(source = "",target = "TEXTURE"),
//            @Mapping(source = "",target = "PRESSURE_TOPLIMIT"),
//            @Mapping(source = "",target = "PRESSURE_LOWERLIMIT"),
//            @Mapping(source = "",target = "IP"),
//            @Mapping(source = "",target = "PORT"),
            @Mapping(source = "terminalPhone", target = "PHONE_NUMBER"),
            @Mapping(source = "remark", target = "REMARK"),
            @Mapping(source = "modelName", target = "TYPE"),
            @Mapping(expression="java((dgTerminalArchive.getLng() !=null && dgTerminalArchive.getLat() !=null) ? dgTerminalArchive.getLng() + \",\"+ dgTerminalArchive.getLat() : null)",target = "LNG_LAT"),
            @Mapping(source = "address", target = "ADDRESS"),
//            @Mapping(source = "",target = "ZONE_ID"),
//            @Mapping(source = "",target = "tenant_id"),
            @Mapping(source = "terminalInstallDate", target = "CREATE_DATE", dateFormat = "yyyy-MM-dd HH:mm:ss"),
//            @Mapping(source = "",target = "COMMUNICATION_TYPE"),
            @Mapping(source = "userTerminals",target = "FFM_ID"),
    })
    FileFlowMeter toFileFlowMeter(DgTerminalArchive dgTerminalArchive);
}
